Loading TOC...

MarkLogic 9 Product Documentation
GET /v1/transactions/{txid}

Summary

Retrieve status information for the transaction whose id matches the txid given in the request URI.

URL Parameters
format? Specifies the content type of the response, as an alternative to using the Accept header. Accepted values: json and xml. This value takes precedence over the Accept headers.
database? Perform this operation on the named content database instead of the default content database associated with the REST API instance. Using an alternative database requires the "eval-in" privilege; for details, see Security Requirements in the REST Application Developer's Guide.
Request Headers
Accept* The expected MIME type of the information in the response. Accepted types: application/json or application/xml. Ignored if the request includes a format parameter value.
Response Headers
Content-Type The MIME type of the data in the response, either application/json or application/xml, depending upon the MIME type requested through the format parameter or Accept header on the request.

Response

Upon success, MarkLogic Server returns status 200 (OK) and returns the transaction status details in the response body. If the transaction no longer exists, MarkLogic Server responds with 400 (Bad Request).

Required Privileges

This operation requires the rest-writer role, or the following privileges:

http://marklogic.com/xdmp/privileges/rest-writer

http://marklogic.com/xdmp/privileges/rest-reader

Usage Notes

The txid component of the request URI is a transaction id, such as is returned by creating a transaction with a POST request on the /transactions service.

The expected response type can be specified using either the format parameter or Accept header. One or the other must be supplied. If both are supplied and are different, the format parameter takes precedence.

For more details, see Checking Transaction Status in the REST Application Developer's Guide.

Example

$ curl --anyauth --user user:password -X GET -i -H "Accept: application/xml" \
  http://localhost:8000/v1/transactions/12782288875903241087

==> Transaction status information for the requested transaction, as XML.
    For example:

Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close

HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 1011
Connection: close

<rapi:transaction-status xmlns:rapi="http://marklogic.com/rest-api">
  <rapi:host>
    <rapi:host-id>15127489353049502680</rapi:host-id>
    <rapi:host-name>host-3.marklogic.com</rapi:host-name>
  </rapi:host>
  <rapi:server>
    <rapi:server-id>16702373622226553017</rapi:server-id>
    <rapi:server-name>RESTstop</rapi:server-name>
  </rapi:server>
  <rapi:database>
    <rapi:database-id>6332900397030137722</rapi:database-id>
    <rapi:database-name>bill</rapi:database-name>
  </rapi:database>
  <rapi:transaction-id>1602843393196055927</rapi:transaction-id>
  <rapi:transaction-name>client-txn</rapi:transaction-name>
  <rapi:transaction-mode>update</rapi:transaction-mode>
  <rapi:transaction-timestamp>0</rapi:transaction-timestamp>
  <rapi:transaction-state>idle</rapi:transaction-state>
  <rapi:canceled>false</rapi:canceled>
  <rapi:start-time>2012-05-07T16:32:42-07:00</rapi:start-time>
  <rapi:time-limit>600</rapi:time-limit>
  <rapi:max-time-limit>3600</rapi:max-time-limit>
  <rapi:user>7071164303237443533</rapi:user>
  <rapi:admin>true</rapi:admin>
</rapi:transaction-status>
  

Example

$ curl --anyauth --user user:password -X GET -i -H "Accept: application/json" \
  http://localhost:8000/v1/transactions/12782288875903241087

==> Transaction status information for the requested transaction, as JSON.
    For example:

Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close

HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 647
Connection: close

{
  "transaction-status": {
    "host": {
      "host-id": "15127489353049502680",
      "host-name": "host-3.marklogic.com"
    },
    "server": {
      "server-id": "16702373622226553017",
      "server-name": "RESTstop"
    },
    "database": {
      "database-id": "6332900397030137722",
      "database-name": "bill"
    },
    "transaction-id": "27981556736957754",
    "transaction-name": "client-txn",
    "transaction-mode": "update",
    "transaction-timestamp": "0",
    "transaction-state": "idle",
    "canceled": "false",
    "start-time": "2012-05-07T16:53:00-07:00",
    "time-limit": "600",
    "max-time-limit": "3600",
    "user": "7071164303237443533",
    "admin": "true"
  }
}
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.